home *** CD-ROM | disk | FTP | other *** search
Wrap
unit SteveASO_TLB; // ************************************************************************ // // WARNING // ------- // The types declared in this file were generated from data read from a // Type Library. If this type library is explicitly or indirectly (via // another type library referring to this type library) re-imported, or the // 'Refresh' command of the Type Library Editor activated while editing the // Type Library, the contents of this file will be regenerated and all // manual modifications will be lost. // ************************************************************************ // // PASTLWTR : $Revision: 1.88 $ // File generated on 9/3/99 4:07:33 AM from Type Library described below. // *************************************************************************// // NOTE: // Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties // which return objects that may need to be explicitly created via a function // call prior to any access via the property. These items have been disabled // in order to prevent accidental use from within the object inspector. You // may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively // removing them from the $IFDEF blocks. However, such items must still be // programmatically created via a method of the appropriate CoClass before // they can be used. // ************************************************************************ // // Type Lib: C:\My Documents\DelphiMag, Oct99\ASP\SteveASO.tlb (1) // IID\LCID: {CB75DB3F-F931-4AB2-A10A-C9E45765E1E3}\0 // Helpfile: // DepndLst: // (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\StdOle2.Tlb) // (2) v4.0 StdVCL, (C:\WINDOWS\SYSTEM\STDVCL40.DLL) // ************************************************************************ // {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. interface uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL; // *********************************************************************// // GUIDS declared in the TypeLibrary. Following prefixes are used: // Type Libraries : LIBID_xxxx // CoClasses : CLASS_xxxx // DISPInterfaces : DIID_xxxx // Non-DISP interfaces: IID_xxxx // *********************************************************************// const // TypeLibrary Major and minor versions SteveASOMajorVersion = 1; SteveASOMinorVersion = 0; LIBID_SteveASO: TGUID = '{CB75DB3F-F931-4AB2-A10A-C9E45765E1E3}'; IID_ISteveServerObj: TGUID = '{4C2D4D31-084E-4F38-ACA8-87DD5A2F2F6E}'; CLASS_SteveServerObj: TGUID = '{D1B27AC4-B8FF-4C71-B9BF-A1C01BFE199B}'; type // *********************************************************************// // Forward declaration of types defined in TypeLibrary // *********************************************************************// ISteveServerObj = interface; ISteveServerObjDisp = dispinterface; // *********************************************************************// // Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// SteveServerObj = ISteveServerObj; // *********************************************************************// // Interface: ISteveServerObj // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {4C2D4D31-084E-4F38-ACA8-87DD5A2F2F6E} // *********************************************************************// ISteveServerObj = interface(IDispatch) ['{4C2D4D31-084E-4F38-ACA8-87DD5A2F2F6E}'] procedure DoIt; safecall; end; // *********************************************************************// // DispIntf: ISteveServerObjDisp // Flags: (4416) Dual OleAutomation Dispatchable // GUID: {4C2D4D31-084E-4F38-ACA8-87DD5A2F2F6E} // *********************************************************************// ISteveServerObjDisp = dispinterface ['{4C2D4D31-084E-4F38-ACA8-87DD5A2F2F6E}'] procedure DoIt; dispid 1; end; // *********************************************************************// // The Class CoSteveServerObj provides a Create and CreateRemote method to // create instances of the default interface ISteveServerObj exposed by // the CoClass SteveServerObj. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CoSteveServerObj = class class function Create: ISteveServerObj; class function CreateRemote(const MachineName: string): ISteveServerObj; end; // *********************************************************************// // OLE Server Proxy class declaration // Server Object : TSteveServerObj // Help String : SteveServerObj Object // Default Interface: ISteveServerObj // Def. Intf. DISP? : No // Event Interface: // TypeFlags : (2) CanCreate // *********************************************************************// {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} TSteveServerObjProperties= class; {$ENDIF} TSteveServerObj = class(TOleServer) private FIntf: ISteveServerObj; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps: TSteveServerObjProperties; function GetServerProperties: TSteveServerObjProperties; {$ENDIF} function GetDefaultInterface: ISteveServerObj; protected procedure InitServerData; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; procedure Connect; override; procedure ConnectTo(svrIntf: ISteveServerObj); procedure Disconnect; override; procedure DoIt; property DefaultInterface: ISteveServerObj read GetDefaultInterface; published {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} property Server: TSteveServerObjProperties read GetServerProperties; {$ENDIF} end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} // *********************************************************************// // OLE Server Properties Proxy Class // Server Object : TSteveServerObj // (This object is used by the IDE's Property Inspector to allow editing // of the properties of this server) // *********************************************************************// TSteveServerObjProperties = class(TPersistent) private FServer: TSteveServerObj; function GetDefaultInterface: ISteveServerObj; constructor Create(AServer: TSteveServerObj); protected public property DefaultInterface: ISteveServerObj read GetDefaultInterface; published end; {$ENDIF} procedure Register; implementation uses ComObj; class function CoSteveServerObj.Create: ISteveServerObj; begin Result := CreateComObject(CLASS_SteveServerObj) as ISteveServerObj; end; class function CoSteveServerObj.CreateRemote(const MachineName: string): ISteveServerObj; begin Result := CreateRemoteComObject(MachineName, CLASS_SteveServerObj) as ISteveServerObj; end; procedure TSteveServerObj.InitServerData; const CServerData: TServerData = ( ClassID: '{D1B27AC4-B8FF-4C71-B9BF-A1C01BFE199B}'; IntfIID: '{4C2D4D31-084E-4F38-ACA8-87DD5A2F2F6E}'; EventIID: ''; LicenseKey: nil; Version: 500); begin ServerData := @CServerData; end; procedure TSteveServerObj.Connect; var punk: IUnknown; begin if FIntf = nil then begin punk := GetServer; Fintf:= punk as ISteveServerObj; end; end; procedure TSteveServerObj.ConnectTo(svrIntf: ISteveServerObj); begin Disconnect; FIntf := svrIntf; end; procedure TSteveServerObj.DisConnect; begin if Fintf <> nil then begin FIntf := nil; end; end; function TSteveServerObj.GetDefaultInterface: ISteveServerObj; begin if FIntf = nil then Connect; Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation'); Result := FIntf; end; constructor TSteveServerObj.Create(AOwner: TComponent); begin inherited Create(AOwner); {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps := TSteveServerObjProperties.Create(Self); {$ENDIF} end; destructor TSteveServerObj.Destroy; begin {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} FProps.Free; {$ENDIF} inherited Destroy; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} function TSteveServerObj.GetServerProperties: TSteveServerObjProperties; begin Result := FProps; end; {$ENDIF} procedure TSteveServerObj.DoIt; begin DefaultInterface.DoIt; end; {$IFDEF LIVE_SERVER_AT_DESIGN_TIME} constructor TSteveServerObjProperties.Create(AServer: TSteveServerObj); begin inherited Create; FServer := AServer; end; function TSteveServerObjProperties.GetDefaultInterface: ISteveServerObj; begin Result := FServer.DefaultInterface; end; {$ENDIF} procedure Register; begin RegisterComponents('Servers',[TSteveServerObj]); end; end.